import App from './App'
import uviewPlus from '@/uni_modules/uview-plus'
// pinia
import * as Pinia from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'

Vue.config.productionTip  = false

App.mpType  = 'app'
const app = new Vue({
  ...App
})

app.$mount()
// #endif

import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  app.use(uviewPlus)

  // 创建 pinia 实例并应用插件
  const pinia = Pinia.createPinia();
  pinia.use(piniaPluginPersistedstate);

  app.use(pinia);

  return {
    app,
    Pinia // 这里返回 Pinia 是为了在其他地方可以方便地使用 useStore 等功能
  }
}
